<template>
    <div class="askNewItem" @click="go">
        <div class="title">
            {{ item.info }} <span> {{ item.title }}</span>
        </div>
        <div v-if="item.ans_data" class="con">
            <div class="user">
                <img
                    :src="item.ans_data.message.extendedData.avatar"
                    class="user-avatar"
                    alt=""
                />
                {{ item.ans_data.message.extendedData.nickname }}
                <span>回答了你的问题</span>
            </div>
            <div class="text">
                {{ item.ans_data.message.message }}
            </div>
            <div class="time">{{ item.add_time_text }}</div>
        </div>
    </div>
</template>
  
<script>
export default {
    name: "askNewItem",
    props: {
        item: {
            type: Object,
            default: () => {
                return {};
            },
        },
    },
    data() {
        return {};
    },
    computed: {},
    mounted() {},
    methods: {
        go() {
            if (this.item.quiz.status == 3) {
                let { href } = this.$router.resolve({
                    path: "/cswd/" + this.item.quiz_id + ".html",
                });
                window.open(href, "_blank");
            } else {
                this.$router.push({
                    path: `/chat/${this.item.quiz_id}`
                });
               
            }
        },
    },
};
</script>
<style lang="scss" scoped>
.askNewItem {
    padding: 20px 44px 12px;
    cursor: pointer;
    &:hover {
        background: #f7f9fb;
        .title {
            // color: #1C87F3;
            span {
                text-decoration: underline;
            }
        }
    }
}
.title {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 18px;
    color: #333333;
    margin-bottom: 17px;
    padding: 0 12px;
    span {
        color: #1c87f3;
    }
}
.con {
    background: #f8fafd;
    padding: 15px 24px 25px;
    .user {
        display: flex;
        font-size: 14px;
        color: #333333;
        display: flex;
        align-items: center;
        .user-avatar {
            width: 30px;
            height: 30px;
            border-radius: 30px;
            margin-right: 9px;
            object-fit: cover;
        }
        span {
            padding-left: 14px;
            font-size: 14px;
            color: #999999;
        }
    }
    .text {
        margin-top: 11px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 16px;
        color: #666666;
    }
    .time {
        margin-top: 14px;
        font-size: 12px;
        color: #999999;
    }
}
</style>
  